package options

import "github.com/xuelang-group/sh-solver-scheduler/pkg/core"

type Appcontext struct {
	UserId        string
	AppId         string
	AppType       core.AppType
	ServiceConfig ServiceConfig
}

type ServiceConfig struct {
	Scale int
	Cpu   int
	Ram   int

	CacheMaxInSeconds int
	ConsumeBlock      int
	ConsumeDelay      int
	MqMasterMaxLen    int
	MqMaxLen          int
	MqTrimImmediately bool

	IsolationMode string     // 'v1' | 'v2'
	Mode          string     // 模板启动模式，调试模式启动，该值为 "debug"
	NodeConfig    NodeConfig // 模板启动节点设置
}

const (
	NodeRunModeStart  = "runStart"
	NodeRunModeStop   = "runStop"
	NodeRunModeAll    = "runAll"
	NodeRunModeSelect = "runSelect"
)

type NodeConfig struct {
	Mode string // 节点启动模式，runStart || runStop || runSelected || runAll
	Ids  []string
}

type SolverTaskContext struct {
	UserId       string         `json:"userId"`
	AppId        string         `json:"appId"`
	NodeId       string         `json:"nodeId"`
	RunType      string         `json:"runType"`
	Cmd          string         `json:"cmd"`
	DownloadList []DownloadList `json:"downloadList"`
	UploadList   []UploadList   `json:"uploadList"`
}

type DownloadList struct {
	IsDir     bool   `json:"isDir"`
	OssPath   string `json:"ossPath"`
	LocalPath string `json:"localPath"`
}

type UploadList struct {
	IsDir     bool   `json:"isDir"`
	OssPath   string `json:"ossPath"`
	LocalPath string `json:"localPath"`
}

type ServiceAppNodeOptions struct {
	Name string
}
